package com.honghu.villagepost.activity;

import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.honghu.villagepost.adapter.SupplyDemandAdapter;
import com.honghu.villagepost.base.BaseListActivity;

import java.util.List;

public class SupplyDemandActivity extends BaseListActivity<String> {

    private SupplyDemandAdapter mSupplyDemandAdapter;

    @Override
    protected void bindRecyclerView(RecyclerView recLv) {
        setMainTitle("供求列表");

        recLv.setLayoutManager(new LinearLayoutManager(this));
        recLv.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
        mSupplyDemandAdapter = new SupplyDemandAdapter();
        recLv.setAdapter(mSupplyDemandAdapter);

    }

    @Override
    protected void loadData(int page, int pageCount) {

        mSupplyDemandAdapter.addData("");
        mSupplyDemandAdapter.addData("");
        mSupplyDemandAdapter.addData("");

        onGetDataSuc(mSupplyDemandAdapter.getData());

    }

    @Override
    protected List<String> getData() {
        return mSupplyDemandAdapter.getData();
    }

    @Override
    protected void bindData(boolean isRefresh, List<String> list) {
        if (isRefresh){
            mSupplyDemandAdapter.setNewData(list);
        }else {
            mSupplyDemandAdapter.addData(list);
        }
    }

}
